<template>
    <div class="orderListRuleForm">
        <panle title='提现审批记录' content="提现审批记录"></panle>

        <el-form :inline="true" ref="form" :model="form" label-width="80px" class="demo-form-inline">
            <el-form-item label="审核时间" prop="operate_time">
                <el-date-picker
                    v-model="form.operate_time"
                    type="daterange"
                    align="right"
                    size="mini"
                    unlink-panels
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    format="yyyy-MM-dd"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    :default-time="['00:00:00', '23:59:59']">
                </el-date-picker>
            </el-form-item>
            <el-form-item label="审核状态:" prop="status">
                <el-select v-model="form.status" placeholder="请选择" size="mini">
                    <el-option label="通过" value="1"></el-option>
                    <el-option label="拒绝" value="2"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="审核人:" prop="operate_name">
                <el-input size="mini" placeholder="请输入" v-model="form.operate_name"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="search" size="mini">搜索</el-button>
                <el-button @click="resetForm('form')" size="mini">重置</el-button>
                <el-button size="mini" @click="init()">刷新</el-button>
            </el-form-item>
        </el-form>

        <div class="table-wrap">
            <el-table :data="tableData" v-loading="loading" style="width: 100%;margin-bottom: 20px;" row-key="id" border
                      stripe default-expand-all>
              <el-table-column type="selection" width="55"></el-table-column>
              <el-table-column prop="user_name" label="申请人姓名"></el-table-column>
              <el-table-column prop="status" label="审核状态">
                  <template slot-scope="scope">
                      <span v-if="scope.row.status == 1">通过</span>
                      <span v-else-if="scope.row.status == 2">拒绝</span>
                  </template>
              </el-table-column>
              <el-table-column prop="operate_time" label="审核时间"></el-table-column>
              <el-table-column prop="operate_name" label="审核人员"></el-table-column>
            </el-table>
            <div class="block">
                <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                               :current-page="form.pageNumber" :page-sizes="[10, 50, 100, 200]"
                               :page-size="form.pageSize"
                               background layout="total, sizes, prev, pager, next, jumper"
                               :total="form.total"></el-pagination>
            </div>
        </div>
    </div>
</template>

<script>
import {
    getUserPayRecord
} from "@/api/sell/examineRecord/examineRecord";

import Panle from '@/components/Panle';
import PersButton from '@/components/PersButton';
import {hasPermission, isShow} from '@/common/permission';

export default {
    name:'Examine-Pay-Record',
    components: {
        Panle,
        PersButton,
    },
    data() {
        return {
            loading:false,
            tableData: [],
            form: {
                operate_time:[],
                status:'',
                operate_name:'',
                pageSize: 10,
                pageNumber: 1,
                total: 0,

            },
        }
    },
    created() {
        this.init(true);
    },
    methods: {
        hasPermission,
        isShow,
        init() {
              this.loading = true;
            getUserPayRecord(this.form).then((res) => {
                    this.tableData = res.data.data;
                    this.form.total = res.data.total;
                    this.loading = false;
                })

        },

        search: function () {
            this.loading = true;
            this.form.pageSize = 10;
            this.form.pageNumber = 1;
            this.init();
        },
        handleSizeChange: function (e) {
            this.form.pageSize = e;
            this.init();
        },
        handleCurrentChange: function (e) {
            this.form.pageNumber = e;
            this.init();
        },
        resetForm(formName) {
            this.form.operate_time = [];
            this.form.status = ''
            this.form.operate_name = ''
            this.init();
        },
    }
}

</script>

<style lang="scss" scoped>
.demo-form-inline {
    margin: 20px;

    .el-form-item {
        margin-bottom: 0;
    }
}
.el-form--inline .el-form-item {
    display: inline-block;
    vertical-align: top;
}

.orderListRuleForm .el-form-item {
    margin-bottom: 0;
}

.search-content {
    width: 100%;
    margin: 20px;
}


</style>